/*     */ package base;
/*     */ 
/*     */ import base.Condutor;
/*     */ import base.Solicitacao;
/*     */ import base.StatusSolicitacao;
/*     */ import base.Veiculo;
import bdSQL.Banco;
import bdSQL.CondutorAction;
import bdSQL.DataUtils;
import bdSQL.VeiculoAction;
/*     */ import java.sql.ResultSet;
/*     */ import java.text.SimpleDateFormat;
/*     */ 
/*     */ public class SolicitacaoAction
/*     */ {
/*  13 */   String sql = "";
/*  14 */   ResultSet rs = null;
/*     */ 
/*     */   public ResultSet verificaSolicitacoesPorUsuario(Integer idUsuario)
/*     */   {
/*  23 */     Banco banco = Banco.getInstance();
/*  24 */     SimpleDateFormat formater = new SimpleDateFormat("dd/MM/yyyy");
/*     */ 
/*  26 */     this.sql = ("SELECT DISTINCT so.idSolicitacao , so.tipoSolic, so.dataSolic, so.motivo, so.dataSaida, so.itinerario, so.razaoNaoAtendida,  so.dataRetorno, so.horaSaida, so.horaRetorno ,so.idCondutor, so.idVeiculo, so.idUsuario, st.descricao, so.horaSolic FROM solicitacao AS so  INNER JOIN statusSolicitacao  AS st ON so.idStatusSolic = st.idStatusSolic WHERE so.idUsuario =" + idUsuario + " AND so.idStatusSolic = st.idStatusSolic AND so.dataSolic = '" + formater.format(DataUtils.dataAtual()) + "' OR so.dataSolic='" + formater.format(DataUtils.dataAnterior()) + "' AND so.idUsuario =" + idUsuario);
/*     */     try
/*     */     {
/*  35 */       this.rs = banco.consulta(this.sql);
/*     */     }
/*     */     catch (Exception e) {
/*  38 */       e.printStackTrace();
/*     */     }
/*     */ 
/*  41 */     return this.rs;
/*     */   }
/*     */ 
/*     */   public ResultSet verificaSolicitacoesEmAberto()
/*     */   {
/*  51 */     Banco banco = Banco.getInstance();
/*  52 */     this.sql = "SELECT so.idSolicitacao, so.dataSaida,so.horaSaida, so.dataRetorno, so.horaRetorno, so.tipoSolic, so.itinerario, us.nome as nomeUsuario, se.sigla as nomeSetor FROM solicitacao as so  INNER JOIN usuario as us on so.idusuario = us.idusuario INNER JOIN setor as se on us.idSetor = se.idSetor WHERE so.idStatusSolic = 1 ORDER BY so.dataSaida, so.horaSaida";
/*     */     try
/*     */     {
/*  59 */       this.rs = banco.consulta(this.sql);
/*     */     } catch (Exception e) {
/*  61 */       e.printStackTrace();
/*     */     }
/*  63 */     return this.rs;
/*     */   }
/*     */ 
/*     */   public ResultSet verificaSolicitacoesLocaisEPlantoesEmAberto()
/*     */   {
/*  72 */     Banco banco = Banco.getInstance();
/*  73 */     this.sql = "SELECT so.idSolicitacao, so.dataSaida,so.horaSaida, so.dataRetorno, so.horaRetorno, so.tipoSolic, so.itinerario, so.passageiros, us.ramal as ramal, us.nome as nomeUsuario,so.datasolic,so.horasolic, se.sigla as nomeSetor FROM solicitacao as so  INNER JOIN usuario as us on so.idusuario = us.idusuario INNER JOIN setor as se on us.idSetor = se.idSetor WHERE so.idStatusSolic = 1 AND so.tipoSolic != 'V' ORDER BY so.dataSaida, so.horaSaida";
/*     */     try
/*     */     {
/*  80 */       this.rs = banco.consulta(this.sql);
/*     */     } catch (Exception e) {
/*  82 */       e.printStackTrace();
/*     */     }
/*  84 */     return this.rs;
/*     */   }
/*     */ 
/*     */   public ResultSet verificaSolicitacoesViagensEmAberto()
/*     */   {
/*  93 */     Banco banco = Banco.getInstance();
/*  94 */     this.sql = "SELECT so.idSolicitacao, so.dataSaida,so.horaSaida, so.dataRetorno, so.horaRetorno, so.tipoSolic,  so.itinerario, so.passageiros, se.sigla , so.motivo, us.nome as nomeUsuario,so.datasolic FROM solicitacao as so  INNER JOIN usuario as us on so.idusuario = us.idusuario INNER JOIN setor as se on us.idSetor = se.idSetor WHERE so.idStatusSolic = 1 AND so.tipoSolic = 'V' ORDER BY so.dataSaida, so.horaSaida";
/*     */     try
/*     */     {
/* 101 */       this.rs = banco.consulta(this.sql);
/*     */     } catch (Exception e) {
/* 103 */       e.printStackTrace();
/*     */     }
/* 105 */     return this.rs;
/*     */   }
/*     */ 
/*     */   public ResultSet verificaSolicitacoesProgramadas()
/*     */   {
/* 114 */     Banco banco = Banco.getInstance();
/* 115 */     this.sql = "SELECT so.idSolicitacao, so.dataSaida,so.horaSaida, so.dataRetorno, so.horaRetorno,  so.tipoSolic, so.itinerario, us.nome as nomeUsuario, se.sigla as nomeSetor, so.passageiros FROM solicitacao as so  INNER JOIN usuario as us on so.idusuario = us.idusuario INNER JOIN setor as se on us.idSetor = se.idSetor WHERE so.idStatusSolic = 2 ORDER BY so.dataSaida, so.horaSaida";
/*     */     try
/*     */     {
/* 122 */       this.rs = banco.consulta(this.sql);
/*     */     } catch (Exception e) {
/* 124 */       e.printStackTrace();
/*     */     }
/* 126 */     return this.rs;
/*     */   }
/*     */ 
/*     */   public ResultSet verificaSolicitacoesEmAndamento()
/*     */   {
/* 135 */     Banco banco = Banco.getInstance();
/* 136 */     this.sql = "SELECT so.idSolicitacao, so.dataSaida,so.horaSaida, so.dataRetorno, so.horaRetorno,  so.tipoSolic, so.itinerario, us.nome as nomeUsuario, se.sigla as nomeSetor, so.passageiros FROM solicitacao as so  INNER JOIN usuario as us on so.idusuario = us.idusuario INNER JOIN setor as se on us.idSetor = se.idSetor WHERE so.idStatusSolic = 4 ORDER BY so.idSolicitacao";
/*     */     try
/*     */     {
/* 143 */       this.rs = banco.consulta(this.sql);
/*     */     } catch (Exception e) {
/* 145 */       e.printStackTrace();
/*     */     }
/* 147 */     return this.rs;
/*     */   }
/*     */ 
/*     */   public boolean inserir(String dataSaida, String horaSaida, String dataRetorno, String horaRetorno, String tipoSolic, String motivo, String itinerario, String necessidades, String passageiros, Integer idUsuario)
/*     */   {
/* 152 */     Banco banco = Banco.getInstance();
/* 153 */     SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
/* 154 */     Solicitacao solic = new Solicitacao();
/* 155 */     solic.setDataSaida(DataUtils.stringToSqlDate(dataSaida));
/* 156 */     solic.setHoraSaida(horaSaida);
/* 157 */     solic.setHoraRetorno(horaRetorno);
/* 158 */     solic.setDataRetorno(DataUtils.stringToSqlDate(dataRetorno));
/* 159 */     solic.setTipoSolicitacao(tipoSolic);
/* 160 */     solic.setMotivo(motivo.toUpperCase());
/* 161 */     solic.setItinerario(itinerario.toUpperCase());
/* 162 */     solic.setNecessidades(necessidades.toUpperCase());
/* 163 */     solic.setPassageiros(passageiros.toUpperCase());
/*     */ 
/* 165 */     this.sql = ("INSERT INTO solicitacao (tipoSolic, dataSolic, motivo, dataSaida, dataRetorno, horaSaida, horaRetorno, notificado, idUsuario, idStatusSolic, itinerario, necessidades, passageiros, horaSolic) VALUES ('" + solic.getTipoSolicitacao() + "','" + sdf.format(DataUtils.dataAtual()) + "','" + solic.getMotivo() + "','" + sdf.format(solic.getDataSaida()) + "','" + sdf.format(solic.getDataRetorno()) + "','" + solic.getHoraSaida() + "','" + solic.getHoraRetorno() + "','" + solic.getNotificado() + "'," + idUsuario + ",1,'" + solic.getItinerario() + "','" + solic.getNecessidades() + "', '" + solic.getPassageiros() + "','" + DataUtils.horaAtual() + "')");
/*     */ 
/* 171 */     if (banco.executa(this.sql)) {
/* 172 */       return true;
/*     */     }
/* 174 */     return false;
/*     */   }
/*     */ 
/*     */   public boolean inserirViagem(String dataSaida, String horaSaida, String dataRetorno, String horaRetorno, String tipoSolic, String motivo, String itinerario, String necessidades, String passageiros, Integer idUsuario)
/*     */   {
/* 179 */     boolean flag = true;
/* 180 */     Banco banco = Banco.getInstance();
/* 181 */     SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
/* 182 */     Solicitacao solic = new Solicitacao();
/* 183 */     solic.setDataSaida(DataUtils.stringToSqlDate(dataSaida));
/* 184 */     solic.setHoraSaida(horaSaida);
/* 185 */     solic.setHoraRetorno(horaRetorno);
/* 186 */     solic.setDataRetorno(DataUtils.stringToSqlDate(dataRetorno));
/* 187 */     solic.setTipoSolicitacao(tipoSolic);
/* 188 */     solic.setMotivo(motivo.toUpperCase());
/* 189 */     solic.setNecessidades(necessidades.toUpperCase());
/* 190 */     solic.setPassageiros(passageiros.toUpperCase());
/*     */ 
/* 192 */     this.sql = ("INSERT INTO solicitacao (tipoSolic, dataSolic, motivo, dataSaida, dataRetorno, horaSaida, horaRetorno,  notificado, idUsuario, idStatusSolic, necessidades, passageiros, horaSolic) VALUES ('" + solic.getTipoSolicitacao() + "','" + sdf.format(DataUtils.dataAtual()) + "','" + solic.getMotivo() + "','" + sdf.format(solic.getDataSaida()) + "','" + sdf.format(solic.getDataRetorno()) + "','" + solic.getHoraSaida() + "','" + solic.getHoraRetorno() + "','" + solic.getNotificado() + "'," + idUsuario + ",1,'" + solic.getNecessidades() + "', '" + solic.getPassageiros() + "','" + DataUtils.horaAtual() + "')");
/*     */ 
/* 198 */     if (banco.executa(this.sql)) {
/* 199 */       flag = true;
/*     */     }
/* 201 */     this.sql = ("SELECT idSolicitacao FROM solicitacao WHERE tipoSolic='" + solic.getTipoSolicitacao() + "' AND " + " dataSaida = '" + sdf.format(solic.getDataSaida()) + "' AND horaSaida = '" + solic.getHoraSaida() + "'");
/*     */     try
/*     */     {
/* 204 */       this.rs = banco.consulta(this.sql);
/* 205 */       while (this.rs.next())
/* 206 */         solic.setIdSolicitacao(new Integer(this.rs.getInt("idSolicitacao")));
/*     */     }
/*     */     catch (Exception e) {
/* 209 */       e.printStackTrace();
/*     */     }
/* 211 */     if (itinerario != null) {
/* 212 */       String[] muns = itinerario.split("\\,");
/* 213 */       for (int i = 0; i < muns.length; i++) {
/* 214 */         if (!muns[i].equals("")) {
/* 215 */           this.sql = ("INSERT INTO solicitacao_municipio (idMunicipio, idSolicitacao) VALUES(" + muns[i] + "," + solic.getIdSolicitacao() + ")");
/*     */ 
/* 218 */           banco.executa(this.sql);
/*     */         }
/*     */       }
/*     */     }
/* 222 */     return flag;
/*     */   }
/*     */ 
/*     */   public boolean atenderSolicitacao(String idCondutor, String idVeiculo, String idSolic)
/*     */   {
/* 227 */     Banco banco = Banco.getInstance();
/* 228 */     VeiculoAction veiculoAction = new VeiculoAction();
/* 229 */     CondutorAction condutorAction = new CondutorAction();
/*     */ 
/* 231 */     Veiculo veiculo = new Veiculo();
/* 232 */     veiculo.setIdVeiculo(new Integer(idVeiculo));
/* 233 */     veiculoAction.setVeiculoAlocado(veiculo);
/*     */ 
/* 235 */     Condutor cond = new Condutor();
/* 236 */     cond.setIdCondutor(new Integer(idCondutor));
/* 237 */     condutorAction.setCondutorAlocado(cond);
/*     */ 
/* 239 */     this.sql = ("UPDATE solicitacao SET idCondutor=" + new Integer(idCondutor) + ", idVeiculo=" + new Integer(idVeiculo) + ", idStatusSolic=2, notificado='S' WHERE idSolicitacao = " + new Integer(idSolic));
/*     */     try
/*     */     {
/* 242 */       banco.executa(this.sql);
/*     */     } catch (Exception e) {
/* 244 */       e.printStackTrace();
/*     */     }
/* 246 */     return false;
/*     */   }
/*     */ 
/*     */   public boolean atenderSolicitacao(String idSolic) {
/* 250 */     Banco banco = Banco.getInstance();
/*     */ 
/* 252 */     this.sql = ("UPDATE solicitacao SET idStatusSolic=2, notificado='S' WHERE idSolicitacao = " + new Integer(idSolic));
/*     */     try {
/* 254 */       banco.executa(this.sql);
/*     */     } catch (Exception e) {
/* 256 */       e.printStackTrace();
/*     */     }
/* 258 */     return false;
/*     */   }
/*     */ 
/*     */   public boolean negarSolicitacao(String razao, String idSolic) {
/* 262 */     Banco banco = Banco.getInstance();
/*     */ 
/* 264 */     this.sql = ("UPDATE solicitacao SET razaoNaoAtendida='" + razao.toUpperCase() + "', idStatusSolic=3, notificado='S' WHERE idSolicitacao = " + new Integer(idSolic));
/*     */     try {
/* 266 */       banco.executa(this.sql);
/*     */     } catch (Exception e) {
/* 268 */       e.printStackTrace();
/*     */     }
/* 270 */     return false;
/*     */   }
/*     */ 
/*     */   public boolean processarSolicitacao(String idSolic) {
/* 274 */     Banco banco = Banco.getInstance();
/*     */ 
/* 276 */     VeiculoAction veiculoAction = new VeiculoAction();
/* 277 */     CondutorAction condutorAction = new CondutorAction();
/* 278 */     Solicitacao solic = getSolicitacao(idSolic);
/*     */ 
/* 280 */     if ((solic.getVeiculo() == null) || (solic.getCondutor() == null)) {
/* 281 */       return false;
/*     */     }
/* 283 */     veiculoAction.setVeiculoOcupado(solic.getVeiculo());
/* 284 */     condutorAction.setCondutorOcupado(solic.getCondutor());
/* 285 */     this.sql = ("UPDATE solicitacao SET idStatusSolic=4 WHERE idSolicitacao = " + new Integer(idSolic));
/*     */     try {
/* 287 */       banco.executa(this.sql);
/* 288 */       return true;
/*     */     } catch (Exception e) {
/* 290 */       e.printStackTrace();
/*     */     }
/* 292 */     return false;
/*     */   }
/*     */ 
/*     */   public boolean cancelarSolicitacao(String idSolic) {
/* 296 */     Banco banco = Banco.getInstance();
/*     */ 
/* 298 */     VeiculoAction veiculoAction = new VeiculoAction();
/* 299 */     CondutorAction condutorAction = new CondutorAction();
/* 300 */     Solicitacao solic = getSolicitacao(idSolic);
/* 301 */     if ((solic.getVeiculo() != null) || (solic.getCondutor() != null)) {
/* 302 */       veiculoAction.setVeiculoDisponivel(solic.getVeiculo());
/* 303 */       condutorAction.setCondutorDisponivel(solic.getCondutor());
/*     */     }
/* 305 */     this.sql = ("UPDATE solicitacao SET idStatusSolic=6 WHERE idSolicitacao = " + new Integer(idSolic));
/*     */     try {
/* 307 */       banco.executa(this.sql);
/*     */     } catch (Exception e) {
/* 309 */       e.printStackTrace();
/*     */     }
/* 311 */     return false;
/*     */   }
/*     */ 
/*     */   public boolean finalizarSolicitacao(String idSolic) {
/* 315 */     Banco banco = Banco.getInstance();
/*     */ 
/* 317 */     VeiculoAction veiculoAction = new VeiculoAction();
/* 318 */     CondutorAction condutorAction = new CondutorAction();
/* 319 */     Solicitacao solic = getSolicitacao(idSolic);
/* 320 */     veiculoAction.setVeiculoDisponivel(solic.getVeiculo());
/* 321 */     condutorAction.setCondutorDisponivel(solic.getCondutor());
/*     */ 
/* 323 */     this.sql = ("UPDATE solicitacao SET idStatusSolic=5 WHERE idSolicitacao = " + new Integer(idSolic));
/*     */     try {
/* 325 */       banco.executa(this.sql);
/*     */     } catch (Exception e) {
/* 327 */       e.printStackTrace();
/*     */     }
/* 329 */     return false;
/*     */   }
/*     */ 
/*     */   public Solicitacao getSolicitacao(String idSolic) {
/* 333 */     Banco banco = Banco.getInstance();
/* 334 */     Solicitacao solic = null;
/* 335 */     VeiculoAction veiculoAction = new VeiculoAction();
/* 336 */     CondutorAction condutorAction = new CondutorAction();
/* 337 */     this.sql = ("SELECT * FROM solicitacao WHERE idSolicitacao=" + new Integer(idSolic));
/*     */     try
/*     */     {
/* 340 */       this.rs = banco.consulta(this.sql);
/*     */ 
/* 342 */       if (this.rs.next()) {
/* 343 */         solic = new Solicitacao();
/* 344 */         solic.setIdSolicitacao(new Integer(idSolic));
/* 345 */         solic.setVeiculo(veiculoAction.getVeiculo(String.valueOf(this.rs.getInt("idVeiculo"))));
/* 346 */         solic.setCondutor(condutorAction.getCondutor(String.valueOf(this.rs.getInt("idCondutor"))));
/* 347 */         solic.setDataSaida(this.rs.getDate("dataSaida"));
/* 348 */         solic.setDataRetorno(this.rs.getDate("dataRetorno"));
/* 349 */         solic.setHoraSaida(this.rs.getString("horaSaida"));
/* 350 */         solic.setHoraRetorno(this.rs.getString("horaRetorno"));
/* 351 */         solic.setItinerario(this.rs.getString("itinerario"));
/* 352 */         solic.setMotivo(this.rs.getString("motivo"));
/* 353 */         solic.setNotificado(this.rs.getString("notificado"));
/* 354 */         solic.setTipoSolicitacao(this.rs.getString("tipoSolic"));
/* 355 */         solic.setNecessidades(this.rs.getString("necessidades"));
/* 356 */         solic.setPassageiros(this.rs.getString("passageiros"));
/* 357 */         solic.setStatusSolic(new StatusSolicitacao(new Integer(this.rs.getInt("idStatusSolic"))));
/*     */       }
/*     */     }
/*     */     catch (Exception e) {
/* 361 */       e.printStackTrace();
/*     */     }
/*     */ 
/* 364 */     return solic;
/*     */   }
/*     */ 
/*     */   public ResultSet listItinerarioViagem(Integer idSolic) {
/* 368 */     Banco banco = Banco.getInstance();
/* 369 */     this.sql = ("SELECT mu.nome, mu.idMunicipio FROM solicitacao so INNER JOIN solicitacao_municipio sm ON sm.idSolicitacao = so.idsolicitacao INNER JOIN municipio mu ON mu.idmunicipio = sm.idmunicipio WHERE so.idSolicitacao =" + idSolic);
/*     */     try
/*     */     {
/* 375 */       this.rs = banco.consulta(this.sql);
/*     */     } catch (Exception ex) {
/* 377 */       ex.printStackTrace();
/*     */     }
/*     */ 
/* 380 */     return this.rs;
/*     */   }
/*     */ 
/*     */   public ResultSet getPassageiros(Integer idSolic) {
/* 384 */     Banco banco = Banco.getInstance();
/* 385 */     this.sql = ("SELECT passageiros FROM solicitacao WHERE idSolicitacao =" + idSolic);
/*     */     try
/*     */     {
/* 388 */       this.rs = banco.consulta(this.sql);
/*     */     } catch (Exception ex) {
/* 390 */       ex.printStackTrace();
/*     */     }
/*     */ 
/* 393 */     return this.rs;
/*     */   }
/*     */ 
/*     */   public ResultSet filtrarSolicitacoesEmAberto(String dataInicial, String dataFinal, String setor, String tipo)
/*     */   {
/* 402 */     Banco banco = Banco.getInstance();
/* 403 */     String tipoSolic = "";
/*     */ 
/* 405 */     if (null != tipo) {
/* 406 */       if (tipo.equals("L"))
/* 407 */         tipoSolic = " AND so.tipoSolic = 'L' ";
/* 408 */       else if (tipo.equals("V"))
/* 409 */         tipoSolic = " AND so.tipoSolic = 'V' ";
/* 410 */       else if (tipo.equals("P")) {
/* 411 */         tipoSolic = " AND so.tipoSolic = 'P' ";
/*     */       }
/*     */     }
/*     */ 
/* 415 */     if (dataInicial == null) {
/* 416 */       dataInicial = "";
/*     */     }
/* 418 */     if (dataFinal == null) {
/* 419 */       dataFinal = "";
/*     */     }
/* 421 */     if (setor == null) {
/* 422 */       setor = "0";
/*     */     }
/*     */ 
/* 425 */     if ((!dataInicial.equals("")) && (!dataFinal.equals("")) && (!setor.equals("0"))) {
/* 426 */       this.sql = ("SELECT so.idSolicitacao, so.dataSaida,so.horaSaida, so.dataRetorno, so.horaRetorno, so.tipoSolic,  so.itinerario, us.nome AS nomeUsuario, se.sigla AS nomeSetor, so.passageiros FROM solicitacao AS so  INNER JOIN usuario AS us ON so.idusuario = us.idusuario INNER JOIN setor AS se ON us.idSetor = se.idSetor WHERE so.idStatusSolic = 1  AND dataSaida >= '" + dataInicial + "' AND dataSaida <= '" + dataFinal + "' AND us.idSetor = " + new Integer(setor) + tipoSolic + " ORDER BY so.dataSaida, so.horaSaida");
/*     */     }
/* 435 */     else if ((!dataInicial.equals("")) && (dataFinal.equals("")) && (!setor.equals("0"))) {
/* 436 */       this.sql = ("SELECT so.idSolicitacao, so.dataSaida,so.horaSaida, so.dataRetorno, so.horaRetorno, so.tipoSolic,  so.itinerario, us.nome AS nomeUsuario, se.sigla AS nomeSetor, so.passageiros FROM solicitacao AS so  INNER JOIN usuario AS us ON so.idusuario = us.idusuario INNER JOIN setor AS se ON us.idSetor = se.idSetor WHERE so.idStatusSolic = 1  AND dataSaida >= '" + dataInicial + "' AND us.idSetor = " + new Integer(setor) + tipoSolic + " ORDER BY so.dataSaida, so.horaSaida ");
/*     */     }
/* 445 */     else if ((dataInicial.equals("")) && (!dataFinal.equals("")) && (!setor.equals("0"))) {
/* 446 */       this.sql = ("SELECT so.idSolicitacao, so.dataSaida,so.horaSaida, so.dataRetorno, so.horaRetorno, so.tipoSolic,  so.itinerario, us.nome AS nomeUsuario, se.sigla AS nomeSetor, so.passageiros FROM solicitacao AS so  INNER JOIN usuario AS us ON so.idusuario = us.idusuario INNER JOIN setor AS se ON us.idSetor = se.idSetor WHERE so.idStatusSolic = 1  AND dataSaida <= '" + dataFinal + "' AND us.idSetor = " + new Integer(setor) + tipoSolic + " ORDER BY so.dataSaida, so.horaSaida");
/*     */     }
/* 455 */     else if ((dataInicial.equals("")) && (!dataFinal.equals("")) && (setor.equals("0"))) {
/* 456 */       this.sql = ("SELECT so.idSolicitacao, so.dataSaida,so.horaSaida, so.dataRetorno, so.horaRetorno, so.tipoSolic,  so.itinerario, us.nome AS nomeUsuario, se.sigla AS nomeSetor, so.passageiros FROM solicitacao AS so  INNER JOIN usuario AS us ON so.idusuario = us.idusuario INNER JOIN setor AS se ON us.idSetor = se.idSetor WHERE so.idStatusSolic = 1  AND dataSaida <= '" + dataFinal + "' " + tipoSolic + " ORDER BY so.dataSaida, so.horaSaida");
/*     */     }
/* 465 */     else if ((!dataInicial.equals("")) && (dataFinal.equals("")) && (setor.equals("0"))) {
/* 466 */       this.sql = ("SELECT so.idSolicitacao, so.dataSaida,so.horaSaida, so.dataRetorno, so.horaRetorno, so.tipoSolic,  so.itinerario, us.nome AS nomeUsuario, se.sigla AS nomeSetor, so.passageiros FROM solicitacao AS so  INNER JOIN usuario AS us ON so.idusuario = us.idusuario INNER JOIN setor AS se ON us.idSetor = se.idSetor WHERE so.idStatusSolic = 1  AND dataSaida >= '" + dataInicial + "' " + tipoSolic + " ORDER BY so.dataSaida, so.horaSaida");
/*     */     }
/* 475 */     else if ((dataInicial.equals("")) && (dataFinal.equals("")) && (!setor.equals("0"))) {
/* 476 */       this.sql = ("SELECT so.idSolicitacao, so.dataSaida,so.horaSaida, so.dataRetorno, so.horaRetorno, so.tipoSolic,  so.itinerario, us.nome AS nomeUsuario, se.sigla AS nomeSetor, so.passageiros FROM solicitacao AS so  INNER JOIN usuario AS us ON so.idusuario = us.idusuario INNER JOIN setor AS se ON us.idSetor = se.idSetor WHERE so.idStatusSolic = 1  AND us.idSetor = " + new Integer(setor) + tipoSolic + " ORDER BY so.dataSaida, so.horaSaida");
/*     */     }
/* 485 */     else if ((!dataInicial.equals("")) && (!dataFinal.equals("")) && (setor.equals("0"))) {
/* 486 */       this.sql = ("SELECT so.idSolicitacao, so.dataSaida,so.horaSaida, so.dataRetorno, so.horaRetorno, so.tipoSolic,  so.itinerario, us.nome AS nomeUsuario, se.sigla AS nomeSetor, so.passageiros FROM solicitacao AS so  INNER JOIN usuario AS us ON so.idusuario = us.idusuario INNER JOIN setor AS se ON us.idSetor = se.idSetor WHERE so.idStatusSolic = 1  AND dataSaida >= '" + dataInicial + "' AND dataSaida <= '" + dataFinal + "'" + tipoSolic + " ORDER BY so.dataSaida, so.horaSaida");
/*     */     }
/*     */ 
/*     */     try
/*     */     {
/* 497 */       this.rs = banco.consulta(this.sql);
/*     */     } catch (Exception e) {
/* 499 */       e.printStackTrace();
/*     */     }
/* 501 */     return this.rs;
/*     */   }
/*     */ 
/*     */   public ResultSet verificaSolicitacoesPassadas(Integer idUsuario)
/*     */   {
/* 511 */     Banco banco = Banco.getInstance();
/*     */ 
/* 513 */     this.sql = ("SELECT DISTINCT so.idSolicitacao , so.tipoSolic, so.dataSolic, so.motivo, so.dataSaida, so.itinerario, so.razaoNaoAtendida,  so.dataRetorno, so.horaSaida, so.horaRetorno , so.idUsuario,so.passageiros ,st.descricao FROM solicitacao AS so  INNER JOIN statusSolicitacao  AS st ON so.idStatusSolic = st.idStatusSolic WHERE so.idUsuario =" + idUsuario + " AND so.idStatusSolic != 5 ORDER BY so.dataSaida DESC,so.horaSaida ASC");
/*     */     try
/*     */     {
/* 521 */       this.rs = banco.consulta(this.sql);
/*     */     }
/*     */     catch (Exception e) {
/* 524 */       e.printStackTrace();
/*     */     }
/*     */ 
/* 527 */     return this.rs;
/*     */   }
/*     */ }

/* Location:           C:\Users\samuel\Desktop\
 * Qualified Name:     bdSQL.SolicitacaoAction
 * JD-Core Version:    0.6.2
 */